<template>
	<view>
		<page-head title="新增分类">
		</page-head>
		
		<view class="uni-padding-wrap uni-common-mt">
			<form @submit="formSubmit" @reset="formReset">
				<view class="uni-form-item uni-column">
					<view class="title">分类名称</view>
					<input class="uni-input" name="cat_name" placeholder="请输入分类名称" />
				</view>

				<view class="uni-btn-v">
					<button form-type="submit" type="primary">保存</button>
					<button type="default" form-type="reset">重置</button>
				</view>
			</form>
		</view>
	</view>
</template>
<script>
	import graceChecker from "../../../common/graceChecker.js"
	import api from "@/utils/api.js";
	export default {
		data() {
			return {
			}
		},
		methods: {
			formSubmit: async function(e) {
				var formData = e.detail.value;
				console.log(formData)

				await api.categoryAdd(formData);
				uni.navigateTo({
					url: "/pages/kucun/category/list"
				})
			},
			formReset: function(e) {
				console.log('清空数据')
			}
		}
	}
</script>

<style>
	.uni-form-item .title {
		padding: 20rpx 0;
	}
</style>
